package com.designed.pattern.creational.factorymethod;

import com.designed.pattern.creational.factorymethod.core.Operation;

/**
 * @author yifei
 * @date 2024/3/28
 **/
public class OperationFactory {

    public Operation createOperation(String operType) {
        IFactory oper = null;
        switch (operType){
            case "+":
            case "-":
            case "*":
            case "/":
                oper = new FactoryBasic();
                break;
            case "pow":
            case "log":
                oper = new FactoryAdvanced();
                break;
        }
        return oper.createOperation(operType);
    }
}
